<?php 
/*
   Copyright 2010, Sanket Parab

   Licensed under the Apache License, Version 2.0 (the "License");
   you may not use this file except in compliance with the License.
   You may obtain a copy of the License at

    http://www.apache.org/licenses/LICENSE-2.0

   Unless required by applicable law or agreed to in writing, software
   distributed under the License is distributed on an "AS IS" BASIS,
   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   See the License for the specific language governing permissions and
   limitations under the License.
   
   This is a Test User Interface meant for demo purposes.
 */
$access_level = 3;
$page_title = 'eTAT';
require_once 'controller.php';
if(!isset($params->e)) {
//	$_SESSION['m'] = '5';
//	redirect('index.php');
	$params->e = base64_encode('sanketsp@gmail.com');
	$params->i = base64_encode('2');
	$params->g = base64_encode('1');
}
require_once 'Header.php';
print "<h1>Student Information</h1><br>";

if(isset($_POST['student_info_submit'])) {
	$query = mysql_query("UPDATE `student` WHERE `id` = '{$_POST['$student_id']}");
} else {
	$gmail = base64_decode($params->e);
	$id = base64_decode($params->i);
	$instructor = new Instructor($id);
	$group = base64_decode($params->g);
?>
<p>Hi <?php print $email; ?>,</p>
<p>You have been requested by <?php print "$instructor->full_name ($instructor->email)"; ?> to fill out this form.</p>
<p>The data that you will fill out below is intended for this Teamwork Assessment Tool (eTAT) only, and will not be shared with anyone.</p>
<p>If you have any concerns, please email your instructor <a href='mailto:<?php print $instructor->email; ?>'>here</a>.</p>
<br>
<?php
	$form = new Form('student_info','post');
	$form->text('<p>Name and Email:</p>');
	$form->textInput('full_name','Full Name');
	$form->textInput('gmail','Gmail Address',array('value'=>$gmail,'readonly'=>true));
	$form->textInput('group_id','',array('class'=>'invisible','value'=>$group));
	$form->textInput('instructor_id','',array('class'=>'invisible','value'=>$instructor->id));
	$form->button('student_info_submit','Submit');
	print $form->build();
}
?>
<div class='clear'></div>
<?php require_once 'footer.php'; ?>